<extend name="../layout" />

<block name="main_content">
    <div class="widget-box">
        <div class="widget-title"> <span class="icon"> <i class="icon-info-sign"></i> </span>
            <h5>{:L('relationship_company')} - {:L('list')}</h5>
            <a href="javascript:add();" class="label label-info">{:L('add_new_customer')}</a>
        </div>
        <div class="widget-content nopadding">
            <table class="table table-bordered table-striped with-check">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>{:L('name')}</th>
                        <th>{:L('phone')}</th>
                        <th>{:L('contact')}</th>
                        <th>{:L('region')}</th>
                        <th>{:L('saler_name')}</th>
                        <th>{:L('dateline')}</th>
                        <th>{:L('status')}</th>
                        <th>{:L('operation')}</th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="list" id="l">
                        <tr>
                            <td>{$l.id}</td>
                            <td>{$l.name}</td>
                            <td>{$l.phone}</td>
                            <td>{$l.contact}</td>
                            <td>{$l.region_id|toRegionPath}</td>
                            <td>{$l.User.truename}</td>
                            <td>{$l.dateline|toDate}</td>
                            <td><span class="badge badge-{$l.status_class}">{:L($l[status_lang])}</span></td>
                            <td>
                                <a href="javascript:edit({$l.id})" title="{:L('edit')}"><i class="icon icon-pencil"></i> </a>
                                <a href="javascript:viewDetail({$l.id})" title="{:L('view_detail')}"><i class='icon icon-list'></i> </a>
                                <if condition="$l[user_id] eq $user[id]">
                                    <if condition="$l[status] eq 1">
                                        <a href="{:U('/CRM/RelationshipCompany/changeStatus/status/0/id/'.$l[id])}" title="{:L('set_customer_private')}"><i class="icon icon-lock"></i> </a>
                                    <else />
                                         <a href="{:U('/CRM/RelationshipCompany/changeStatus/status/1/id/'.$l[id])}" title="{:L('set_customer_public')}"><i class="icon icon-unlock"></i> </a>
                                    </if>
                                    <a href="javascript:del({$l.id});" title="{:L('delete')}"><i class="icon icon-remove"></i> </a>
                                </if>
                            </td>
                        </tr>
                    </volist>
                    <tr>
                        <td colspan="10">
                            <div class="pagination alternate"><ul>{$page}</ul></div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</block>